package com.cking.wherehaveibeen;

import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class MySQLHelper extends SQLiteOpenHelper {
	  
	  public static final String TABLE_COMMENTS = "points";
	  public static final String COLUMN_ID = "_id";
	  public static final String COLUMN_POINTS = "point";
	  public static final String COLUMN_DATE = "date";

	  private static final String DATABASE_NAME = "mydatabase.sqlite";
	  private static final int DATABASE_VERSION = 1;

	  // Database creation sql statement
	  private static final String DATABASE_CREATE = "create table "
	      + TABLE_COMMENTS + "(" + COLUMN_ID
	      + " integer primary key autoincrement, "+ COLUMN_DATE
	      + " text not null, " + COLUMN_POINTS
	      + " text not null);";
	  
	  public MySQLHelper(Context context) {
		    super(context, DATABASE_NAME, null, DATABASE_VERSION);
	  }
	  
	  @Override
	  public void onCreate(SQLiteDatabase database) {
<<<<<<< .mine
		try {
      		database.execSQL(DATABASE_CREATE);	
      	} catch (SQLException e) {
      		e.printStackTrace();
      	}
=======
		  try {
      		database.execSQL(DATABASE_CREATE);	
      	} catch (SQLException e) {
      		e.printStackTrace();
      	}
>>>>>>> .r26
	  }

	  @Override
	  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	    Log.w(MySQLHelper.class.getName(),
	        "Upgrading database from version " + oldVersion + " to "
	            + newVersion + ", which will destroy all old data");
	    db.execSQL("DROP TABLE IF EXISTS " + TABLE_COMMENTS);
	    onCreate(db);
	  }

	} 